home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 October / Macformat17.cdr / Shareware City / Developers / WASTETCL / WASTE TCL / CTSMSwitchboard.cpp next >
Encoding:
C/C++ Source or Header  |  1994-05-16  |  2.5 KB  |  97 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  CTSMSwitchboard.cpp
  3.  
  4.  ******************************************************************************/
  5.  
  6. #include "CTSMSwitchboard.h"
  7. #include "Global.h"
  8. #include "TBUtilities.h"
  9. #include "CApplication.h"
  10. #include "CDesktop.h"
  11. #include "CBartender.h"
  12. #include "CWindow.h"
  13. #include "Commands.h"
  14. #include "Constants.h"
  15. #include "CAppleEvent.h"
  16. #ifndef __APPLEEVENTS__
  17. #include <AppleEvents.h>
  18. #endif
  19. #ifndef __AEOBJECTS__
  20. #include <AEObjects.h>
  21. #endif
  22. #ifndef __AEREGISTRY__
  23. #include "AERegistry.h"
  24. #endif
  25. #ifndef __DISKINIT__
  26. #include <DiskInit.h>
  27. #endif
  28. #ifndef __DESK__
  29. #include <Desk.h>
  30. #endif
  31.  
  32. #include "CAppleEventObject.h"
  33. //#include "EPPC.h"
  34. #include "WASTE.h"
  35.  
  36. /*** Global Variables ***/
  37.     
  38. extern CApplication    *gApplication;        /* Application object                */
  39. extern CDesktop        *gDesktop;            /* The visible Desktop                */
  40. extern CBartender    *gBartender;        /* Manages all menus                */
  41. extern CBureaucrat    *gGopher;            /* First in line to get commands    */
  42. extern EventRecord    gLastMouseDown;        /* Previous mouse down event        */
  43. extern EventRecord    gLastMouseUp;        /* Previous mouse up event            */
  44. extern CView        *gLastViewHit;        /* Last view clicked in                */
  45. extern long            gSleepTime;            /* Max time between events            */
  46.                                         // TCL 1.1.3 11/30/92 BF
  47. extern Boolean        gInBackground;        /* In background under MultiFinder    */
  48. extern short         gUsingTSM;            /* Using Text Service Manager       */
  49.  
  50. /*** Class Constants ***/
  51.  
  52. #define        MouseMovedEvt        0xFA    /* Mouse moved event code            */
  53. #define        SuspendResumeEvt    0x01    /* Suspend/Resume event code        */
  54. #define        ResumeEvtMask        0x1        /* Supend or Resume selector        */
  55. #define        ConvertScrapMask    0x2        /* Scrap conversion flag            */
  56.  
  57. CTSMSwitchboard::CTSMSwitchboard()
  58.     : CSwitchboard()
  59. {
  60. }
  61.  
  62. void CTSMSwitchboard::ITSMSwitchboard(void)
  63. {
  64. }
  65.  
  66. void    CTSMSwitchboard::ProcessEvent( void)
  67. {
  68.     EventRecord            macEvent;        /* Mac Event to be processed        */
  69.     Boolean                isMyEvent;        /* Should program handle event?        */
  70.     Point                mouseLoc;        /* Mouse location in global coords    */
  71.     Boolean                handledByTSM=false;
  72.  
  73.         
  74.     gDesktop->Prepare();
  75.     GetMouse(&mouseLoc);
  76.  
  77.     gDesktop->DispatchCursor(mouseLoc, mouseRgn);
  78.  
  79.                                         /* Get an event from the queue        */
  80.     isMyEvent = GetAnEvent( &macEvent);
  81.     
  82.     if (gUsingTSM)
  83.     {
  84.         handledByTSM = TSMEvent(&macEvent);
  85.     }
  86.     
  87.     if (isMyEvent && !handledByTSM)            /* We must respond to this event    */
  88.     {            
  89.         DispatchEvent( &macEvent);        
  90.     } 
  91.     else 
  92.     {                                    /* No action required                */
  93.         DoIdle( &macEvent);
  94.     }
  95. }
  96.  
  97.